﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   namespace="PSAdmin.Core.Domain"
                   assembly="PSAdmin.Core">
  <class name="PSScript" table="PSScripts">
    <id name="Id" unsaved-value="0">
      <generator class="hilo"/>
    </id>

    <property name="Name" type="string"/>
    <property name="Description" type="string"/>
    <property name="CommandText" type="string"/>
    <property name="Impersonate"/>
    <property name="Username"/>
    <property name="Password"/>
    <property name="Domain"/>
    
    <set name="Variables" table="PSScriptVariables" inverse="true" cascade="all-delete-orphan">
      <key column="PSScriptId"></key>
      <one-to-many class="PSScriptVariable"/>
    </set>
    <set name="Roles" table="PSScripts_Roles">
      <key column="PSScriptId"/>
      <many-to-many column="UserRoleId" class="PSAdmin.Core.Security.UserRole"/>
    </set>
  </class>
</hibernate-mapping>